package com.springboot.springbootlogindemo.service.serviceImpl;

import com.springboot.springbootlogindemo.DTO.UserLikCountDTO;
import com.springboot.springbootlogindemo.DTO.UserLikesDto;
import com.springboot.springbootlogindemo.mapper.ContentStatsMapper;
import com.springboot.springbootlogindemo.mapper.UserLikesMapper;
import com.springboot.springbootlogindemo.service.LikeService;
import com.springboot.springbootlogindemo.utils.CacheClient;
import com.springboot.springbootlogindemo.utils.RedisUtils;
import com.springboot.springbootlogindemo.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LikeServiceImpl implements LikeService {

    @Resource
    private RedisUtils redisUtils;

    @Resource
    private UserLikesMapper userLikesMapper;

    @Resource
    private ContentStatsMapper contentStatsMapper;

    @Resource
    private CacheClient cacheClient;

    @Override
    public Result like(String infoId,String likeUserId) {
        Object o = redisUtils.likeStatus(infoId,likeUserId);
        return Result.success(o);
    }


    @Override
    public Result record(String infoId) {
        //先从redis查，如果没查到，再查数据库，并且从数据库将数据放入到缓存中
        return Result.error("尚未实现");
    }

    @Override
    public Result count(String infoId) {
        //先从redis查，如果没有查到，再查数据库，并且将数据再放入redis
        return Result.error("尚未实现");
    }

    @Override
    public Result status(String infoId) {
        //先从redis查，如果没有查到，再查数据库，如果也没有查到，返回没点赞。
        return Result.error("尚未实现");
    }

}